local sk__choulve = fk.CreateSkill {

  name = "sk__choulve",

  tags = {  },

}



sk__choulve:addEffect("active", {
  name = "sk__choulve",
  anim_type = "offensive",
  prompt = "#sk__choulve",
  card_num = 2,
  target_num = 2,
  can_use = function(self, player)
    return player:usedSkillTimes(sk__choulve.name, Player.HistoryPhase) == 0
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected < 2 and Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
  end,
  target_filter =function (self, player, to_select, selected, selected_cards)
       return #selected < 2
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target1 = effect.tos[1]
    local target2 = effect.tos[2]
    local from, to = target1, target1
    if Fk:getCardById(effect.cards[1]).number > Fk:getCardById(effect.cards[2]).number then
      to = target2
    elseif Fk:getCardById(effect.cards[1]).number < Fk:getCardById(effect.cards[2]).number then
      from = target2
    end
    local moveInfos = {}
    for i = 1, 2, 1 do
      if effect.tos[i] ~= player then
        table.insert(moveInfos, {
          ids = {effect.cards[i]},
          from = player,
          to = effect.tos[i],
          toArea = Card.PlayerHand,
          moveReason = fk.ReasonGive,
          proposer = player,
          skillName = sk__choulve.name,
          moveVisible = true,
        })
      end
    end
    if #moveInfos > 0 then
      room:moveCards(table.unpack(moveInfos))
    end
    if from ~= to and not to.dead then
      local use = room:useVirtualCard("slash", nil, from, to, sk__choulve.name, true)
      if use and not player.dead and use.damageDealt then
        player:drawCards(1, sk__choulve.name)
      end
    end
  end,
})

return sk__choulve